/*
 * @Author: wuyuxin
 * @Date: 2024-07-30 00:58:04
 * @LastEditors: wuyuxin
 * @LastEditTime: 2024-09-18 18:02:50
 * @Description:
 */
import { configureStore } from '@reduxjs/toolkit'
import {
  useSelector,
  TypedUseSelectorHook,
  useDispatch,
  shallowEqual
} from 'react-redux'

import CounterReducer from './modules/counter'
import RecommendReducer from '@/views/discover/c-views/recommend/store/recommend'

const store = configureStore({
  reducer: {
    counter: CounterReducer,
    recommend: RecommendReducer
  }
})

type GetStateFnType = typeof store.getState
type IRootState = ReturnType<GetStateFnType>
type DispatchType = typeof store.dispatch

export const useAppSelector: TypedUseSelectorHook<IRootState> = useSelector
export const useAppDispatch: () => DispatchType = useDispatch
export const shallowEqualApp = shallowEqual

export default store
